
//
//  TestFactory.m
//  Runner
//
//  Created by yeqingyu on 2019/7/24.
//  Copyright © 2019 The Chromium Authors. All rights reserved.
//

#import "TestFactory.h"
#import "TestViewManager.h"
@interface TestFactory ()
@property (nonatomic, assign) id messenger;
@end
@implementation TestFactory
- (NSObject<FlutterPlatformView>*)createWithFrame:(CGRect)frame
                                   viewIdentifier:(int64_t)viewId
                                        arguments:(id _Nullable)args{
    return [[TestViewManager alloc]initWithWithFrame:frame viewIdentifier:viewId arguments:args binaryMessenger:self.messenger];
}

//注册插件
+ (void)registerWithRegistrar:(NSObject<FlutterPluginRegistrar>*)registrar{
    TestFactory *factor = [[TestFactory alloc]initWithMessenger:registrar.messenger];
    [registrar registerViewFactory:factor withId:@"test"];
}


- (instancetype)initWithMessenger:(NSObject<FlutterBinaryMessenger>*)messager{
    self = [super init];
    if (self) {
        self.messenger = messager;
    }
    return self;
}
@end
